package com.ruoyi.common.core.domain;

import lombok.Data;

import java.util.List;

@Data
public class Result<T> {

    private   int code;
    private  String msg;
    private List<T> data;

    public Result() {

    }
    public Result(int code, String msg, List<T> data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
    public Result error(String msg) {
        this.msg = msg;
        this.code = 500;
        this.data = null;
        return new Result(code,msg,data);
    }

    public Result success(List<T> data) {
        this.msg = "success";
        this.code = 200;
        this.data = data;
        return new Result(code,msg,data);
    }
}
